#include "Solution.h"
#include <iostream>
#include <string>
using namespace std;

int main()
{
	string s,p;


	Solution sol;

	while(true)
	{
		getline(cin,s);		
		if(s == "")
			break;
		getline(cin,p);

		cout<<sol.isMatch(s.c_str(),p.c_str())<<endl;
	}

	while(cin.get() != '\n');
	cin.get();
}